package cn.ffcs.action;

import java.util.ArrayList;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import cn.ffcs.common.base.BaseRunableAction;
import cn.ffcs.common.base.ICallBack;
import cn.ffcs.common.utils.HttpRequest;
import cn.ffcs.common.utils.LogEx;

public class GetPendCount extends BaseRunableAction {

	public static final String CALLBACK_TYPE_SUCCESS = "GetPendCount.success";
	public static final String CALLBACK_TYPE_FAIL = "GetPendCount.success";
	
	private String url;
	private String pwd;
	private String user;

	public GetPendCount(ICallBack iCall) {
		super(iCall);
	}

	public void startGet(String url,String user,String pwd)
	{
		this.url = url;
		this.user = user;
		this.pwd = pwd;
		this.startThread();
	}
	@Override
	public void run() {
		try
		{
			HttpRequest request = new HttpRequest();
			ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
			params.add(new BasicNameValuePair("dh_usr",user));
			params.add(new BasicNameValuePair("userid",user));
			params.add(new BasicNameValuePair("password",pwd));
			String sResult = request.exePost(url, params);
			this.callBack(CALLBACK_TYPE_SUCCESS, sResult.trim());
			//this.callBack(CALLBACK_TYPE_SUCCESS, "");
		}
		catch(Exception e)
		{
			LogEx.Msg(this.getClass().getCanonicalName(),""+e.getMessage());
		}
		
	}

}
